home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 July: Mac OS SDK / Dev.CD Jul 96 SDK / Dev.CD Jul 96 SDK1.toast / Development Kits (Disc 1) / OpenDoc / OpenDoc Development / Debugging Support / OpenDoc Source Code / Storage / Bento / MemHdr.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-04-22  |  3.6 KB  |  125 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        MemHdr.h
  3.  
  4.     Contains:    ODMemContainer header
  5.  
  6.     Written by:    Vincent Lo
  7.  
  8.     Copyright:    © 1993-1994 by Apple Computer, Inc., all rights reserved.
  9.  
  10.     Change History (most recent first):
  11.  
  12.          <2>     6/20/94    CC        ODMemoryHeap* changed to ODMemoryHeapID.
  13.          <1>     5/27/94    VL        first checked in
  14.     To Do:
  15. */
  16.  
  17. #ifndef _MEMHDR_
  18. #define _MEMHDR_
  19.  
  20. #ifndef _ODTYPES_
  21. #include "ODTypes.h"
  22. #endif
  23.  
  24. #ifndef _BENTOHDR_
  25. #include "BentoHdr.h"
  26. #endif
  27.  
  28. #ifndef __CM_API__
  29. #include "CMAPI.h"
  30. #endif
  31.  
  32. #ifndef __CM_API_TYPES__
  33. #include "CMAPITyp.h"
  34. #endif
  35.  
  36. #ifndef _ODMEMORY_
  37. #include "ODMemory.h"
  38. #endif
  39.  
  40. #ifndef _PLFMDEF_
  41. #include "PlfmDef.h"
  42. #endif
  43.  
  44. //==============================================================================
  45. // Theory of Operation
  46. //==============================================================================
  47.  
  48. //==============================================================================
  49. // Constants
  50. //==============================================================================
  51. extern const ODType kODBentoMemoryTypeName; // = "MemoryCtr";
  52.  
  53. //==============================================================================
  54. // Scalar Types
  55. //==============================================================================
  56.  
  57. //==============================================================================
  58. // Classes defined in this interface
  59. //==============================================================================
  60. class ODMemBentoHandlers;
  61.  
  62. //==============================================================================
  63. // Classes used by this interface
  64. //==============================================================================
  65.  
  66. //==============================================================================
  67. // ODMemBentoHandlers
  68. //==============================================================================
  69.  
  70. class ODMemBentoHandlers : public ODBentoHandlers
  71. {
  72. public:
  73.  
  74.     ODMemBentoHandlers(CMSession session, ODHandle data);
  75.     ODVMethod ~ODMemBentoHandlers();
  76.     
  77.     ODMethod void Initialize();
  78.     ODMethod CMSession GetCMSession();
  79.     
  80.     ODMethod CMRefCon OpenHandler(CMOpenMode mode);
  81.     ODMethod void CloseHandler();
  82.     ODMethod CMSize FlushHandler();
  83.     ODMethod CMSize SeekHandler(CM_LONG posOff, CMSeekMode mode);
  84.     ODMethod CMSize TellHandler();
  85.     ODMethod CMSize ReadHandler(CMPtr buffer, CMSize elementSize, CMCount theCount);
  86.     ODMethod CMSize WriteHandler(CMPtr buffer, CMSize elementSize, CMCount theCount);
  87.     ODMethod CMEofStatus EOFHandler();
  88.     ODMethod CMBoolean TruncHandler(CMSize containerSize);
  89.     ODMethod CMSize ContainerSizeHandler();
  90.     ODMethod void ReadLabelHandler(CMMagicBytes magicByteSequence,
  91.                         CMContainerFlags *flags, CM_USHORT *bufSize,
  92.                         CM_USHORT *majorVersion, CM_USHORT *minorVersion,
  93.                         CMSize *tocOffset, CMSize *tocSize);
  94.     ODMethod void WriteLabelHandler(CMMagicBytes magicByteSequence,
  95.                         CMContainerFlags flags, CM_USHORT bufSize,
  96.                         CM_USHORT majorVersion, CM_USHORT minorVersion,
  97.                         CMSize tocOffset, CMSize tocSize);
  98.     ODMethod CMValue ReturnParentValueHandler();
  99.     ODMethod CM_UCHAR* ReturnContainerNameHandler();
  100.     ODMethod CMType ReturnTargetTypeHandler(CMContainer container);
  101.     ODMethod void ExtractDataHandler(CMDataBuffer buffer,
  102.                             CMSize size, CMPrivateData data);
  103.     ODMethod void FormatDataHandler(CMDataBuffer buffer,
  104.                             CMSize size,
  105.                             CMPrivateData data);
  106.  
  107. private:
  108.  
  109.                 void SaveZone();
  110.                 void RestoreZone();
  111.  
  112.     CMSession    fSession;
  113.     ODHandle   fData;
  114.     ODBoolean  fAllocated;
  115.     CMSize      fSize;
  116.     ODBoolean    fSeekValid;
  117.     ODULong    fSeekPos;
  118.     ODSLong    fLastSeekOffset;
  119.     ODSShort    fLastSeekMode;
  120.     ODBoolean  fEOFReached;
  121.     THz            fZone;
  122.     THz            fCurZone;
  123. };
  124.  
  125. #endif // _MEMHDR_